package com.deere.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "parts")
public class GenericPart extends GenericModel {
	private String partCode; // 零件图号
	private String partName;// 零件名称
	private String material;// 材料
	private String partType;// 零件类型
	private Integer weight;// 重量
	private Integer time;
	private String machineType;
	/*
	 * 加工零件的总工时。 总工时为每个工序所需工时之合
	 */
	private int totalManHour;
	/*
	 * 零件加工难度表述。 如： 较易 容易 适中 难 较难 很难等。
	 */
	private String manufactureDiffLevel;

	@Id
	public String getPartCode() {
		return partCode;
	}

	public void setPartCode(String partCode) {
		this.partCode = partCode;
	}

	public String getPartName() {
		return partName;
	}

	public void setPartName(String partName) {
		this.partName = partName;
	}

	public String getMaterial() {
		return material;
	}

	public void setMaterial(String material) {
		this.material = material;
	}

	public String getPartType() {
		return partType;
	}

	public void setPartType(String partType) {
		this.partType = partType;
	}

	public Integer getWeight() {
		return weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	public Integer getTime() {
		return time;
	}

	public void setTime(Integer time) {
		this.time = time;
	}

	public String getMachineType() {
		return machineType;
	}

	public void setMachineType(String machineType) {
		this.machineType = machineType;
	}

	@Column(name = "MANUFACTURE_DIFF_LEVEL")
	public String getManufactureDiffLevel() {
		return manufactureDiffLevel;
	}

	public void setManufactureDiffLevel(String manufactureDiffLevel) {
		this.manufactureDiffLevel = manufactureDiffLevel;
	}

	public int getTotalManHour() {
		return totalManHour;
	}

	@Column(name = "TOTAL_MAN_HOUR")
	public void setTotalManHour(int totalManHour) {
		this.totalManHour = totalManHour;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		int r = 0;
		char[] codeChar = this.partCode.toCharArray();
		for (char c : codeChar) {
			r += c;
		}
		return r;
	}

	@Override
	public String toString() {
		return this.getPartCode() + this.getPartName();
	}

}
